class Solution {
public:
    vector<vector<int> > ret;
    vector<int> ans;
    void backtrace(int n,int cur,int k){
        if(ans.size() == k){
            ret.push_back(ans);
            return;
        }
        for(int i = cur;i <= n;i++){
            ans.push_back(i);
            backtrace(n,i+1,k);
            ans.pop_back();
        }
    }
    vector<vector<int>> combine(int n, int k) {
        backtrace(n,1,k);
        return ret;
    }
};
